package fr.uhp.wiki;

import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;


public class PasswordValidator implements Validator {
	
	public PasswordValidator() {
		super();
	}

	public void validate(FacesContext context, UIComponent component,
			Object value) throws ValidatorException {
		String var = (String)value;
		FacesMessage message = new FacesMessage();
		message.setSummary("Length must be greater than 5");
		
		if(var.length() < 6){
			throw new ValidatorException(message);
		}
	}
}